/**
 * 
 */
package de.cbf.cam.dsa.facet.weapon_ranged.persister.mock;

import java.util.Map;

import de.cbf.cam.dsa.facet.weapon_ranged.FacetWeaponRanged;
import de.cbf.cam.dsa.facet.weapon_ranged.service.persister_interface.IServicePersister_FacetWeaponRanged;
import de.cbf.util.db.interfaces.exceptions.EntityLoadException;
import de.cbf.util.db.interfaces.exceptions.EntitySaveException;
import de.cbf.util.entity.facet.persistence.mock.AbstractServicePersisterMock;
import de.cbf.util.uuidheader.entities.UUIDReference;
import de.cbf.util.uuidheader.interfaces.IUUIDHeader;

/**
 * @author Nebelritter
 *
 */
public class ServicePersister_FacetWeaponRanged_Mock extends AbstractServicePersisterMock implements IServicePersister_FacetWeaponRanged{

    public static final String NAME = "Facet:WeaponRanged:Mock";
	
	
	public ServicePersister_FacetWeaponRanged_Mock() {
		super();		
		
	}
	
	/* (non-Javadoc)
	 * @see de.cbf.util.entity.facet.persistence.mock.AbstractServicePersisterMock#init()
	 */
	@Override
	protected void init() {		
		super.init();
		setDisplayName(NAME);
	}
	
	@Override
	public void persistFacetWeaponRanged(FacetWeaponRanged facet,Map<String, Object> options)
			throws EntitySaveException {
		persistElement(facet,options);				
	}

	@Override
	public FacetWeaponRanged loadFacetWeaponRanged(UUIDReference reference)
			throws EntityLoadException {
		IUUIDHeader element = loadElement(reference);
		if (element instanceof FacetWeaponRanged) {
			FacetWeaponRanged facet = (FacetWeaponRanged) element;
			return facet;
		} else {
			String err_msg = "entity of wrong type(expected "
					+ FacetWeaponRanged.class.getSimpleName() + "): " + (element == null ? "null"
					: element.getClass().getSimpleName());
			throw new EntityLoadException(err_msg);
		}
	}

	@Override
	protected Class<? extends IUUIDHeader> getElementClass() {		
		return FacetWeaponRanged.class;
	}
}
